package cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.controller;

import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.entity.Instruction;
import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.service.InstructionService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 张烁瑜
 * @Date 2025/5/21 16:20
 */
@RestController
@RequestMapping("/instruction")
public class InstructionController {

    @Autowired
    private InstructionService instructionService;

    @PostMapping
    public String save(@RequestBody Instruction instruction) {
        return instructionService.save(instruction);
    }

    @PutMapping
    public String update(@RequestBody Instruction instruction) {
        return instructionService.update(instruction);
    }

    @DeleteMapping("/{id}")
    public String delete(@PathVariable Long id) {
        return instructionService.delete(id);
    }


    @GetMapping
    public PageInfo<Instruction> get(int pageNum, int pageSize, Instruction instruction) {
        return instructionService.get(pageNum, pageSize, instruction);
    }
}